home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / cron.daily / sysklogd < prev   
Text File  |  2008-08-29  |  1KB  |  48 lines

  1. #! /bin/sh
  2.  
  3. # sysklogd    Cron script to rotate system log files daily.
  4. #
  5. #        If you want to rotate other logfiles daily, edit
  6. #        this script.  An easy way is to add files manually,
  7. #        to add -a (for all log files) to syslogd-listfiles and
  8. #        add some grep stuff, or use the -s pattern argument to
  9. #        specify files that must not be listed.
  10. #
  11. #        This is a configration file.  You are invited to edit
  12. #        it and maintain it on your own.  You'll have to do
  13. #        that if you don't like the default policy
  14. #        wrt. rotating logfiles (i.e. with large logfiles
  15. #        weekly and daily rotation may interfere).  If you edit
  16. #        this file and don't let dpkg upgrade it, you have full
  17. #        control over it.  Please read the manpage to
  18. #        syslogd-listfiles.
  19. #
  20. #        Written by Martin Schulze <joey@debian.org>.
  21. #        $Id: cron.daily,v 1.14 2007-05-28 16:33:34 joey Exp $
  22.  
  23. test -x /usr/sbin/syslogd-listfiles || exit 0
  24. test -x /sbin/syslogd || exit 0
  25. test -f /usr/share/sysklogd/dummy || exit 0
  26.  
  27. USER=$(ps -C syslogd -o user= | head -n 1)
  28. [ -z "${USER}" ] && USER="root" || true
  29.  
  30. set -e
  31.  
  32. cd /var/log
  33.  
  34. logs=$(syslogd-listfiles)
  35.  
  36. test -n "$logs" || exit 0
  37.  
  38. for LOG in $logs
  39. do
  40.    if [ -s $LOG ]; then
  41.       savelog -g adm -m 640 -u ${USER} -c 7 $LOG >/dev/null
  42.    fi
  43. done
  44.  
  45. # Restart syslogd
  46. #
  47. /etc/init.d/sysklogd reload-or-restart > /dev/null
  48.